package com.demo.passenger.hotel.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.demo.passenger.hotel.entity.HotelInfo;
import com.demo.passenger.hotel.entity.PassengerResidenceInfo;
import com.demo.passenger.hotel.mapper.HotelInfoMapper;
import com.demo.passenger.hotel.service.IHotelInfoService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 旅店信息表 服务实现类
 * </p>
 *
 * @author weifucheng
 * @since 2019-07-13
 */
@Service
public class HotelInfoServiceImpl extends ServiceImpl<HotelInfoMapper, HotelInfo> implements IHotelInfoService {
@Override
    public List<HotelInfo> listByParams(Page<HotelInfo> page, HotelInfo HotelInfo) {
        return this.baseMapper.listByParams(page,HotelInfo);
    }
    @Override
    public List<HotelInfo> listByParams(HotelInfo HotelInfo) {
        Page<HotelInfo> page=new Page<HotelInfo>();
        page.setSize(Integer.MAX_VALUE);
        return this.baseMapper.listByParams(page,HotelInfo);
    }

    @Override
    public Page<HotelInfo> listByParams(HotelInfo hotelInfo, Integer current, Integer size) {
        Page<HotelInfo> page=new Page<HotelInfo>();
        page.setSize(size);
        page.setCurrent(current);
        page.setRecords(this.baseMapper.listByParams(page,hotelInfo));
        return page;
    }

    @Override
    public List<HotelInfo> listAllSortByCreateTime() {
        QueryWrapper<HotelInfo> queryWrapper = new QueryWrapper<>();
        queryWrapper.orderByAsc("CREATE_TIME");
        return this.baseMapper.selectList(queryWrapper);
    }
}
